home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / mac / MacPlatform.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  3.3 KB  |  102 lines

  1. package com.extensibility.mac;
  2.  
  3. import com.apple.mrj.MRJAboutHandler;
  4. import com.apple.mrj.MRJApplicationUtils;
  5. import com.apple.mrj.MRJFileUtils;
  6. import com.apple.mrj.MRJOSType;
  7. import com.apple.mrj.MRJOpenDocumentHandler;
  8. import com.apple.mrj.MRJPrintDocumentHandler;
  9. import com.apple.mrj.MRJQuitHandler;
  10. import com.extensibility.app.DialogFactory;
  11. import com.extensibility.app.UI;
  12. import com.extensibility.rock.Platform;
  13. import java.awt.event.InputEvent;
  14. import java.awt.event.MouseEvent;
  15. import java.io.File;
  16. import java.io.StringWriter;
  17.  
  18. public class MacPlatform extends Platform implements MRJQuitHandler, MRJAboutHandler, MRJOpenDocumentHandler, MRJPrintDocumentHandler {
  19.    public static final MRJOSType CREATOR_CODE = new MRJOSType(UI.getString("mac.creator.code"));
  20.    public static final MRJOSType TEXT_TYPE = new MRJOSType("TEXT");
  21.    private static final char LINE_SEP_CHAR;
  22.    private Platform.Application theApp;
  23.  
  24.    public MacPlatform() {
  25.       super(2);
  26.    }
  27.  
  28.    public void initPlatform(Platform.Application var1) {
  29.       if (MRJApplicationUtils.isMRJToolkitAvailable()) {
  30.          MRJFileUtils.setDefaultFileCreator(CREATOR_CODE);
  31.          MRJFileUtils.setDefaultFileType(TEXT_TYPE);
  32.          this.theApp = var1;
  33.          MRJApplicationUtils.registerQuitHandler(this);
  34.          MRJApplicationUtils.registerAboutHandler(this);
  35.          MRJApplicationUtils.registerOpenDocumentHandler(this);
  36.          MRJApplicationUtils.registerPrintDocumentHandler(this);
  37.       }
  38.    }
  39.  
  40.    public void handleQuit() {
  41.       this.theApp.quit();
  42.    }
  43.  
  44.    public void handleAbout() {
  45.       this.theApp.openAboutWindow();
  46.    }
  47.  
  48.    public void handleOpenFile(File var1) {
  49.       try {
  50.          if (MRJFileUtils.getFileType(var1).equals(TEXT_TYPE)) {
  51.             this.theApp.openDocument(var1);
  52.          }
  53.       } catch (Exception var3) {
  54.          ((Throwable)var3).printStackTrace();
  55.       }
  56.  
  57.    }
  58.  
  59.    public void handlePrintFile(File var1) {
  60.       try {
  61.          if (MRJFileUtils.getFileType(var1).equals(TEXT_TYPE)) {
  62.          }
  63.       } catch (Exception var3) {
  64.          ((Throwable)var3).printStackTrace();
  65.       }
  66.  
  67.    }
  68.  
  69.    protected String prepStringForTextArea(String var1) {
  70.       return var1 == null ? var1 : var1.replace(LINE_SEP_CHAR, '\n');
  71.    }
  72.  
  73.    protected StringWriter getStringWriter() {
  74.       return new MacTextAreaStringWriter();
  75.    }
  76.  
  77.    protected DialogFactory doMakeDialogFactory() {
  78.       try {
  79.          MacFileDialogs var1 = new MacFileDialogs();
  80.          return var1;
  81.       } catch (Error var3) {
  82.          System.err.println("error creating Mac dialog factory:");
  83.          ((Throwable)var3).printStackTrace();
  84.          DialogFactory var2 = super.doMakeDialogFactory();
  85.          return var2;
  86.       }
  87.    }
  88.  
  89.    protected boolean doMouseEventModified(MouseEvent var1) {
  90.       return (((InputEvent)var1).getModifiers() & 4) > 0;
  91.    }
  92.  
  93.    // $FF: synthetic method
  94.    static char access$2000071() {
  95.       return LINE_SEP_CHAR;
  96.    }
  97.  
  98.    static {
  99.       LINE_SEP_CHAR = Platform.LINE_SEPARATOR.charAt(0);
  100.    }
  101. }
  102.